<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<form action="?s=Index/Index/register" method="post">
    <div class="container ">
        <div class="form-group">
            <label for="exampleInputEmail1">用户名</label>
            <input name="username" type="text" class="form-control" id="1exampleInputUsername" placeholder="username">
        </div>
        <div class="form-group">
            <label for="exampleInputPassword1">密码</label>
            <input name="password" type="password" class="form-control" id="1exampleInputPassword1" placeholder="Password">
        </div>
        <div class="form-group">
            <label for="exampleInputPassword1">确认密码</label>
            <input name="cpassword" type="password" class="form-control" id="2exampleInputPassword1"
                   placeholder="CPassword">
        </div>
        <div class="checkbox">
            <label>
                <input type="checkbox"> Check me out
            </label>
        </div>
        <button type="submit" class="btn btn-default" onclick="Login()">注册</button>
    </div>
</form>

<br>
<br>
<form action="?s=Index/Index/userLogin" method="post">
    <div class="container">
        <div class="form-group">
            <label for="exampleInputEmail1">用户名</label>
            <input name='username' type="text" class="form-control" id="exampleInputEmail1" placeholder="username">
        </div>
        <div class="form-group">
            <label for="exampleInputPassword1">密码</label>
            <input name="password" type="password" class="form-control" id="exampleInputPassword1"
                   placeholder="Password">
        </div>
        <div class="checkbox">
            <label>
                <input type="checkbox"> Check me out
            </label>
        </div>
        <button type="submit" class="btn btn-default" onclick="Register()">登陆</button>
    </div>
</form>
</body>
<script type="application/javascript" src="/Public/assets/js/jquery.js"></script>
<!--<script type="application/javascript" src="/your-project-name/vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script>-->
<script type="text/javascript">
    function Login() {
        var username = $('#1exampleInputUsername').val();
        var password = $('#1exampleInputPassword1').val();
        var cpassword = $('#2exampleInputPassword1').val();
        /*   if (!username) {
         alert('用户名不能为空！');
         return false;
         } else if (!password) {
         alert('密码不能为空！');
         return false;
         } else if (!cpassword) {
         alert('确认密码不能为空！');
         return false;
         } else if (password != cpassword) {
         alert('确认密码与密码不一致！');
         return false;
         }*/
        $.ajax({
            url: "?s=Index/Index/register",
            type: "POST",
            data: "username=" + username + "&password=" + password + "&cpassword=" + cpassword,
            success: function (msg) {
                alert(msg);
            }
        });
        /*        $.post('?s=Index/Index/register', {
         'username': username,
         'password': password,
         'cpassword': cpassword
         }, function (data) {
         alert(data);
         });*/
    }
</script>

<script type="text/javascript">
    function Register() {
        var username=$('#1exampleInputUsername').var();
        var password=$('#exampleInputPassword1').var();
        $.ajax({
            type:"POST",
            url:'?=Index/Index/register',
            date:'username'+username +"&password="+password,
            success:function (date) {
                alert(date);
            }
        });
    }
</script>
</html>